package org.syndicate.domain;

import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;
import org.springframework.transaction.annotation.Transactional;

/**
 * Transaction of facility investment.
 * 
 * @author akiraabe
 */
@RooJavaBean
@RooToString
@RooEntity(inheritanceType = "JOINED")
public class FacilityInvestment extends AbstractTransaction {
	
	/**
	 * {@inheritDoc}
	 * <br/>
	 * Facility is invested. 
	 */
	@Transactional
	@Override
	public AbstractPosition execute() {
		System.out.println("FacilityInvestment#execute");

		this.setDiscriminator("FacilityInvestment");
		
		// Generate new Facility
		Facility facility = new Facility();
		facility.apply(this);

		facility.persist();
		
		return facility;
	}
}
